<{capture name="header"}>
<link href="../apps/ome/statics/ome.css" rel="stylesheet" type="text/css">
<{/capture}>

  <div class="tableform">
    <h3>打包绩效</h3>
  <div class="division">
      <div class="gridlist" style="padding:10px;">
      <form method='post' id ='serachForm' action="index.php?app=omekpi&ctl=admin_packager&act=search">
        时间 <{input name="begin_date" id="begin_date" value="{$begin_date}" type="date" }> 至 <{input type="date" value="{$end_date}"  id="end_date"  name="end_date"}>
        <select name="select" id="select">
          <option value='NO'>员工编号</option>
          <option value='NA'>员工姓名</option>
        </select>
         <{input name="have" type="text" value=''}> <{button label="搜索" type='submit'}> &nbsp;&nbsp; &nbsp;
       </form>
        <table>
        <tr  align='left'>
        
      <td width="40%">
       <form method='post' id ='importForm' action="index.php?app=omekpi&ctl=admin_packager&act=importTable" target='upload' enctype="multipart/form-data">
导入打包员数据<{input type="sfile" name="package" }> 
<input value="上传" type='button' onclick='check()' />
      </form>
      </td>
      <td align="left">
       <form method='post' id ='exportForm' action="index.php?app=omekpi&ctl=admin_packager&act=export"  class="tableform" target='download' enctype="multipart/form-data">
        <{button class="btn btn-primary" label="导出" type='submit'}>
        <textarea name="csv_data" style="display:none;" ><{$csv_data}></textarea>
      </form>
      </td>
      <td><a href='index.php?app=omekpi&ctl=admin_packager&act=exportTmpl' class="tableform" target='download' enctype="multipart/form-data">
      <{button class="btn-primary" label="导出打包员绩效模板" }></a></td><td></td>
      </tr>
      </table>
   </div>
    
<form method="post" id="fm1" action="index.php?app=omekpi&ctl=admin_packager&act=doadd">
      <table class="gridlist" id="purchase_table"  style="margin:4px 0; width:780px;">
        <thead>
          <tr>
            <th>员工编号</th>
            <th>员工姓名</th>
            <th>需打包数量</th>
            <th>已打包数量</th>
            <th>我的打包数量</th>
            <th>日期</th>
          </tr>
        </thead>
        <tbody id="dNode">
         <{foreach from=$packageList item=item key=key}>
          <tr id="<{$item.employee_id}>">
            <td style="display:none;"><{$item.employee_id}></td>
            <td><{$item.employee_op_no}></td>
            <td><{$item.employee_name}></td>
            <td><strong><a key='package_numbers' href="javascript:void(0);"><{$countres}></a></strong></td>
            <td><strong><a key='packaged_numbers' href="javascript:void(0);"><{$item.packaged_numbers}></a></strong></td>
            <td><strong><a key='my_packaged_numbers' href="javascript:void(0);"><{$item.my_packaged_numbers}></a></strong></td>
            <td class='date'><strong><{$item.createdate|date:'Y-m-d'}></strong></td>
          </tr>
         <{/foreach}>
        </tbody>
      </table>
      </form>
      <div class="gridlist-footer" style="width:760px; text-align:right;">需打包：<{$count.package_numbers}> &nbsp;&nbsp;&nbsp;已打包共计：<{$count.packaged_numbers}> &nbsp;&nbsp;&nbsp;我的打包数量：<{$count.count_my_packaged_numbers}></div>
  </div>

<script>
(function(){
 $$("#dNode a").each(function(item,i){
    var parent=item.getParent("tr");
    var id=parent.get("id");
    var name=item.get("key");
    var dates=parent.getChildren("td");
    var date=parent.getElement("td.date").get('text');
    if(name=='package_numbers'){
        item.addEvent('click',function(e){
            var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent('index.php?app=omekpi&ctl=admin_packager&act=getPackage');
            new finderDialog(url,{width:1000,height:660});
        });
    }
    if(name=='packaged_numbers'){
        item.addEvent('click',function(e){
            var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent('index.php?app=omekpi&ctl=admin_packager&act=getPackaged');
            new finderDialog(url,{width:1000,height:660});
        });
    }
    
    if(name=='my_packaged_numbers'){
        item.addEvent('click',function(e){
            var url='index.php?app=desktop&act=alertpages&goto='+encodeURIComponent('index.php?app=omekpi&ctl=admin_packager&act=getMypackaged&id='+id+'&date='+date);
            new finderDialog(url,{width:1000,height:660});
        });
    }
 });
    
})();

function check(){
     var aaa = $(document.body).getElement("input[name=package]");
    if (aaa.value == ''){
        alert("请上传csv文件");
        return false;
    }
    $('importForm').fireEvent('submit',{stop:function(){}});
    return true;
}

</script>
